package com.yowasa.xiuxian.engine.travel.adventure;

import com.google.common.collect.Sets;
import com.yowasa.xiuxian.engine.travel.AdventureInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.MapEnum;
import com.yowasa.xiuxian.entity.enums.RefreshType;
import com.yowasa.xiuxian.service.helper.ItemHelper;
import com.yowasa.xiuxian.service.helper.ResourceHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * 朱果获取
 */
@Component
public class ZhuGuoGet implements AdventureInterface {
    @Autowired
    private ItemHelper itemHelper;
    @Autowired
    private ResourceHelper resourceHelper;


    @Override
    public Set<MapEnum> limitMaps() {
        //凤栖崖only
        return Sets.newHashSet(MapEnum.DI_HUA_ZHOU);
    }

    @Override
    public String exec(UserBO user) {
        if (resourceHelper.checkHaveResource(user.getGuildId(), this.getClass().getName(), RefreshType.JIU_XING)) {
            resourceHelper.useResource(user.getGuildId(), this.getClass().getName());
            itemHelper.addItem(user, "朱果", 1);
            return "你在一处洞窟内发现了朱果树,获取了朱果*1";
        }
        return "你在一处洞窟内发现了朱果树,但是上面的朱果已经被人摘取";
    }

}
